<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>产品信息</title>
		<!-- 引入样式 -->
		<link rel="stylesheet"
			href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script src="https://unpkg.com/vue/dist/vue.js"></script>
		<!-- 引入组件库2332 -->
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<!-- 引入axios -->
		<script src="../js/axios.js"></script>
		<script src="../js/qs.js"></script>
		<!-- 导入jquery -->
		<script src="../js/jquery.min.js"></script>
		<style type="text/css">
.loading {
	width: 100%;
	height: 100%;
	position: fixed;
	background-color: white;
	top: 0px;
	left: 0px;
	z-index: 100;
}

.loading .bigpic {
	width: 104px;
	height: 104px;
	background-image: url("../imgs/loading.gif");
	position: absolute;
	top: 0px;
	bottom: 0px;
	right: 0px;
	left: 0px;
	margin: auto;
}

.select {
	width: 130px;
}

.bg-purple {
	
}

.grid-content {
	border-radius: 4px;
}

.undo {
	background-image: url("");
}
</style>
<script>
<!-- document.addEventListener("readystatechange",function(){
		//对象尚未初始化
		if(document.readyState=="uninitialized"){
			console.log("readystatechange-uninitialized");
		}
		//对象正在加载
		if(document.readyState=="loading"){
			console.log("readystatechange-loading");
		}
		//对象加载数据完成
		if(document.readyState=="loaded"){
			console.log("readystatechange-loaded");
		}
		//可以操作对象，但还没完全加载
		if(document.readyState=="interactive"){
			console.log("readystatechange-interactive");
		}
		//对象已经加载完毕
	     if (document.readyState == "complete") {
	       console.log("readystatechange-complete");
	      }
	  });
	$(function(){
	    //读取数据是否加载成功
	    document.onreadystatechange=function(){
	        //判断页面读取状态   页面读取状态一共四中
	        if(document.readyState == "complete"){
	        //载入完成fadeOut();移除div样式
	            $(".loading").fadeOut();
	        }
	    }
	}); --> 
</script>
</head>
<body>
	<!-- 搜索 -->
	<!-- <div class="loading">
			<div class="bigpic"><div class="bigpic"></div></div>
		</div> -->
	<div id="bigbox">
		<div style="width: 100%; margin-left: 15px; display: block;">
			<i class="el-icon-caret-right" style="line-height: 40px; margin-right: 5px; float: left;"></i>
			<template style="margin-top: 50px;"> 
		<el-select v-model="value7" placeholder="请选择" multiple style="float: left;width:200px;" @change="handleSelect" @visible-change="visibleChange()" @remove-tag="removeTag()"   >
		<!-- :key="group.label",:key="item.value" -->
  		<el-option-group v-for="group in options3" :key="group.label"  :label="group.label" >
   		<el-option v-for="item in group.options"  :key="item.value" :label="item.label" :value="item.value">
   		 </el-option>
  		</el-option-group>
		 </el-select>
			</template>
			<i class="el-icon-search" style="line-height: 40px;float: left;margin-left: 10px; width: 50px; height: 50px;"></i>
			<!-- 搜索框 -->
			<div style="display: block;margin-left: -20px;float: left;">
			<!-- state1Flag=false	 -->
			<el-autocomplete class="inline-input" v-model="state1" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect" @focus="stateManagement(true,1)" @blur="state1Flag=false">
		    	<el-select v-model="select" slot="append" placeholder="请选择" class="select" @change="clearData()">
		      	<el-option label="产品名称" value="1"></el-option>
		      	<!-- <el-option label="产品ID" value="2"></el-option> -->
		    	</el-select>
			 </el-autocomplete>
			</div>
		<!-- 表单 -->
		<div style="width: 99%;float: left;" id="app2">
				<!-- <div style="float: left;margin-left: 30px;margin-top: -10px;"></div> -->
<el-row :gutter="20">
  <el-col :span="20">
  <div class="grid-content bg-purple" style="padding: 10px 0;">
  <span style="font-size: 13px;color: #333333;">产品列表</span> 
	<!--   <div style="width:50px;height:40px;"></div>-->
    <el-tooltip  effect="dark" content="解除搜索，显示全部数据" placement="right" v-show="removeSearch">
      <el-button style="padding:2px 5px; border-radius: 8px;background-color:red;color:white;"v-on:click="removeSearch1()"><img src="../imgs/undo.png" style="width:13px;height:13px;"/><span style="font-size:10px;">解除搜索</span></el-button>
    </el-tooltip>		
  </div>
  </el-col>
  <el-col :span="4"><div class="grid-content bg-purple" style="padding-top:0px;margin-left:40px">
   <el-button size="small" icon="el-icon-circle-plus" v-on:click="loadInfo(0)" @click="dialogFormVisible = true" style="width: 80px;"> 新建</el-button> 
   <el-button type="text" icon="el-icon-setting" @click="showInfo = true"></el-button>
   <el-dialog
  title="产品信息数据显示设置"
  :visible.sync="showInfo"
  width="36%"
  :before-close="handleClose">

 <!-- 
						showpPcId:0,
						showpPrice:0,
						showpUnit:0,
						showpCost:0,
						showpStatus:0,
						showpRemarks:0,
  -->
      <!-- <el-checkbox v-model="showpPcId">分类</el-checkbox> -->
         <el-checkbox v-model="showpPrice">销售价格</el-checkbox>
            <el-checkbox v-model="showpUnit">单位</el-checkbox>
               <el-checkbox v-model="showpCost">成本价格</el-checkbox>
                  <el-checkbox v-model="showpStatus">状态</el-checkbox>
                     <!-- <el-checkbox v-model="showpRemarks">备注</el-checkbox> -->
  <span slot="footer" class="dialog-footer">
    <el-button @click="showInfo = false">取 消</el-button>
    <el-button type="primary" @click="saveshowInfo()">保存</el-button>
  </span>
</el-dialog>
  </div>
  </el-col>
</el-row>
			<div style="float: right; display: block; margin-right: 20px; margin-top: -10px;"@click="deathWindow('form')">


				<!-- 这里是弹窗--start-->
				<el-dialog title="新建产品" :visible.sync="dialogFormVisible" width="70%">
				<hr style="border: 1px solid #000000; margin-top: -15px;" />
				<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">产品</p>
				<hr style="border: 0.5px solid #EEEEEE;" />
				<el-form :model="form" :rules="rules" label-width="150px" ref="form" style="height: 1000px; margin-top: 20px;"> 
					<el-row style="margin-left: -75px;"> 
						<el-col :span="12">
							<el-form-item label="品名" prop="pName">
							 <el-input v-model="form.pName"></el-input> 
							</el-form-item>
						 </el-col>
						 <el-col :span="12"> 
						 	<el-form-item label="单位"> 
						 		<el-select v-model="form.pUnit" filterable placeholder="未选"> 
									<el-option v-for="item in pUnits" :key="item.value" :label="item.label":value="item.value"></el-option> 
								 </el-select>
							</el-form-item> 
						 </el-col> 
						 <!-- <el-col :span="12"> 
						 	<el-form-item label="分类">
						 	 <el-select v-model="form.productclassify" filterable placeholder="未选">
						 	  <el-option v-for="item in PcIds" :key="item.value" :label="item.label" :value="item.value"></el-option> 
							</el-select>
							 <el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">数据字典</div>
								<i class="el-icon-document" id="newtool"></i>
							</el-tooltip>
					  		</el-form-item>
					   </el-col> -->
				    </el-row>
					<el-row style="margin-left: -75px;">
						 <el-col :span="12">
							<el-form-item label="销售价格" prop="pPrice">
							 <el-input v-model.number="form.pPrice"></el-input> 
					 		</el-form-item> 
						 </el-col> 
					 </el-row> 
					<el-row style="margin-left: -75px;"> 
						 <el-col :span="12">
							<el-form-item label="成本价格" prop="pCost"> 
							<el-input v-model.number="form.pCost"></el-input> 
							</el-form-item> 
						</el-col>
					<el-col :span="12"> 
						 <el-form-item label="状态:"> 
							 <el-radio v-model="form.pStatus" label="1209">正常</el-radio>
							 <el-radio v-model="form.pStatus"label="1210">停售</el-radio> 
						 </el-form-item> 
					 </el-col> 
					</el-row>
					<el-row style="margin-left: -75px;">
						<el-col :span="12"> 
							<el-form-item label="产品备注">
								<el-input type="textarea" :rows="2" v-model="form.pRemarks"></el-input>
							</el-form-item>
						 </el-col>
					   </el-row> 
				  <!--  <el-row style="margin-left: -75px;"> 
					   <el-col :span="12">
							<el-form-item label="产品图片:"> 
							<el-upload v-model="form.pImg" class="upload-demo" action="":on-preview="handlePreview" :on-remove="handleRemove":file-list="fileList" list-type="picture"> 
							<el-button size="small" type="primary">点击上传</el-button>
						<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
						</el-upload> 
						</el-form-item> 
						</el-col>
				  </el-row> -->
				<hr style="border: 0.5px solid #EEEEEE;" />						
					<el-form-item style="float: right;margin-top: 40px;">
						<el-button @click="cancelForm('form')">取 消</el-button>
						<el-button type="primary" @click="submitForm('form')" >确定</el-button>
						<el-button @click="resetForm('form')">重置</el-button>
					</el-form-item>
					</el-form>
				</el-dialog>
				<!--这里是弹窗--end-->
			</div>
		</div>

	</div>
	<!-- 表单 -->
	 <!-- 
						showpPcId:0,
						showpPrice:0,
						showpUnit:0,
						showpCost:0,
						showpStatus:0,
						showpRemarks:0,
  -->
	<div id="app3">
	<div id="print"  >
		<el-table ref="multipleTable" tooltip-effect="dark" @selection-change="handleSelectionChange" :data="tableData3"
					 v-loading="tableloading"   :cell-style="cellStyle" :header-cell-style="cellStyle" 
						 border style="border:1px solid #ebeef5;width: 100%;"
					  element-loading-background="rgba(0, 0, 0, 0)"  >
			<el-table-column type="selection" width="35" v-if="printFlag1==false" >
			</el-table-column> 
			<el-table-column prop="pId" label="产品ID"> 
			</el-table-column>
			<el-table-column prop="pName" label="品名"> 
			</el-table-column> 
			<!-- <el-table-column prop="pImg" label="产品图片"> 
				<template scope="scope"><img :src="scope.row.pImg" style="width: 50px; height: 50px;" v-if="scope.row.pImg!=null" /> </template> 
			</el-table-column>  -->
			<!-- <el-table-column prop="pPdId" label="分类" v-if="showpPcId==1"> 
			</el-table-column>  -->	
			<el-table-column prop="pUnit" label="单位" v-if="showpUnit==1">
			 </el-table-column> 
			<el-table-column prop="pStatus" label="状态" v-if="showpStatus==1"> 
			</el-table-column> 
			<el-table-column prop="pPrice" label="销售价格" v-if="showpPrice==1"> 
			</el-table-column> 
			<el-table-column prop="pCost" label="成本价格" v-if="showpCost==1"> 
			</el-table-column>
			
			<el-table-column fixed="right" label="操作" width="100" v-if="printFlag2==false"> 
				<template slot-scope="scope">
				<!-- <el-tooltip content="Bottom center" placement="bottom" width="50px">
							 <div slot="content">产品视图</div>
								<i class="el-icon-document" style="margin: 0px 2px;font-size: 17px;" @click="productView(scope.row.pId)"></i>
							</el-tooltip> -->
					<el-tooltip content="Bottom center" placement="bottom">
						<div slot="content">编辑</div>								
						<i class="el-icon-edit" v-on:click="loadInfo(scope.row.pId)" @click="dialogrepair = true" style="font-size: 17px;"></i>
					</el-tooltip>
						<el-tooltip content="Bottom center" placement="bottom">
						<div slot="content">删除</div>
						<i class="el-icon-delete" style="margin: 0px 10px;font-size: 17px;"  @click="DeleteShow(scope.row.pId)" ></i>
					</el-tooltip>
				</template>
			</el-table-column>
			</el-table>
			</div>
			<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" append-to-body>
			 	 <span>你确定要删除吗？</span>
			  	<span slot="footer" class="dialog-footer">
			    <el-button @click="dialogDelete = false">取 消</el-button>
			    <el-button type="primary" @click="dialogDelete = false" v-on:click="Delete" >确 定</el-button>
			  </span>
			</el-dialog>
		<!-- 修改产品信息 -->
		<div style="float: right; display: block; margin-right: 20px; margin-top: -10px;">
			<!-- 这里是弹窗--start-->
				<el-dialog title="修改产品信息" :visible.sync="dialogrepair" width="70%">
				<hr style="border: 1px solid #000000; margin-top: -15px;" />
				<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">产品</p>
				<hr style="border: 0.5px solid #EEEEEE;" />
				<el-form :model="form" :rules="rules" label-width="150px" ref="form" style="height: 1000px; margin-top: 20px;"> 
					<el-row style="margin-left: -75px;"> 
						<el-col :span="12">
							<el-form-item label="品名" prop="pName">
							 <el-input v-model="form.pName"></el-input> 
							</el-form-item>
						 </el-col>
						 <el-col :span="12"> 
					 	<el-form-item label="单位"> 
					 		<el-select v-model="form.pUnit" filterable placeholder="未选"> 
								<el-option v-for="item in pUnits" :key="item.value" :label="item.label":value="item.value">
							 </el-select>
							 </el-form-item> 
						 </el-col> 
						<!--  <el-col :span="12"> 
						 	<el-form-item label="分类">
						 	 <el-select v-model="form.productclassify" filterable placeholder="未选">
						 	  <el-option v-for="item in PcIds" :key="item.value" :label="item.label" :value="item.value"></el-option> 
							</el-select>
							 <el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">数据字典</div>
								<i class="el-icon-document" id="newtool"></i>
							</el-tooltip>
					  		</el-form-item>
					   </el-col> -->
				    </el-row>
					<el-row style="margin-left: -75px;">
						 <el-col :span="12">
							<el-form-item label="销售价格" prop="pPrice">
							 <el-input v-model="form.pPrice"></el-input> 
					 		</el-form-item> 
						 </el-col> 
					 
					 </el-row> 
					<el-row style="margin-left: -75px;"> 
						 <el-col :span="12">
							<el-form-item label="成本价格"> 
							<el-input v-model="form.pCost"></el-input> 
							</el-form-item> 
						</el-col>
					<el-col :span="12"> 
						 <el-form-item label="状态:"> 
							 <el-radio v-model="form.pStatus" label="1209">正常</el-radio>
							 <el-radio v-model="form.pStatus"label="1210">停售</el-radio> 
						 </el-form-item> 
					 </el-col> 
					</el-row>
					<el-row style="margin-left: -75px;">
						<el-col :span="12"> 
							<el-form-item label="产品备注">
								<el-input type="textarea" :rows="2" v-model="form.pRemarks"></el-input>
							</el-form-item>
						 </el-col>
					   </el-row> 
				  <!--  <el-row style="margin-left: -75px;"> 
					   <el-col :span="12">
							<el-form-item label="产品图片:"> 
							<el-upload v-model="form.pImg" class="upload-demo" action="":on-preview="handlePreview" :on-remove="handleRemove":file-list="fileList" list-type="picture"> 
							<el-button size="small" type="primary">点击上传</el-button>
						<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
						</el-upload> 
						</el-form-item> 
						</el-col>
				  </el-row> -->
				<hr style="border: 0.5px solid #EEEEEE;" />						
					<el-form-item style="float: right;margin-top: 40px;">
						<el-button @click="cancelForm('form')">取 消</el-button>
						<el-button type="primary" @click="submitForm('form')" v-on:click="dialogrepair= false">保存</el-button>
					</el-form-item>
				</el-form>
			</el-dialog>
			<!--这里是弹窗--end-->
			</div>
			<div style="margin-top: 10px">
				<div style="display: block; float: left;margin-left: 5px;">
					<!-- <el-tooltip content="Bottom center" placement="bottom">
						<div slot="content">删除</div>
						<i class="el-icon-delete" style="margin: 8px;font-size: 17px;"></i>
					</el-tooltip> -->
				</div>
				<!-- 分页 -->
					<div style="display: block; float: left; margin-left: 300px;">
						<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4"
						 :page-sizes="page.pageCentent" :pager-count="5" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="page.AllpageNumber">
						</el-pagination>
					</div>
					
					<div style="display: block; float: right;margin-right: 15px;">
						<el-tooltip content="Bottom center" placement="bottom">
							<div slot="content">打印</div>
							<el-button circle size="mini"><i class="el-icon-printer" style="font-size: 17px;" @click="print(7)"></i></el-button>&nbsp;
						</el-tooltip>

						<el-tooltip content="Bottom center" placement="bottom">
							<div slot="content">导出Excel</div>
							<el-button circle size="mini"><i class="el-icon-tickets" style="font-size: 17px;"></i></el-button>
						</el-tooltip>

					</div>
				</div>
			</template>
		</div>
	</div>

	<script type="text/jscript">
				var Main1 = {
					data() {
						//检查输入是否为数字,是否为空  
					      var checkPPrice = (rule, value, callback) => {
					          setTimeout(() => {
					        	 if(value==null||value==''){
					        		 callback();
					        	 }
					            if (!Number.isInteger(value)) {
					              callback(new Error('请输入数字值'));
					            } else {
					                callback();
					            }
					          }, 1000);
					        };
					        
					      //检查输入是否为数字,是否为空  
					        var checkPCost = (rule, value, callback) => {
						          setTimeout(() => {
						        	 if(value==null||value==''){
						        		 callback();
						        	 }
						            if (!Number.isInteger(value)) {
						              callback(new Error('请输入数字值'));
						            } else {
						                callback();
						            }
						          }, 1000);
						        };
					        
					      //检查产品名称是否重复，是否为空    
							   var checkPName = (rule, value, callback) => {
								   if(value==null||value==''){
									   callback(new Error('品名为必填项'));  
								   }
								   var _this=this;
								 	axios.get("/product/findByPName",
						           			{
										params:{
											pNname:value
												}
				           					}
						           			//ajax请求成功的回调函数
						          			).then(function(response){					          				
						           			console.log("回调成功，获取了服务器端返回的值v");
						           			console.log(response.data);//返回id值
						           			console.log(_this.form.pId);
						           			if(response.data){
						           				if(_this.form.pId==response.data){
						           					callback();						           					
						           				}else{
										           	 callback(new Error('该产品名称已存在！请重新命名！'));							           					
						           				}
					           				
						           			}else{
						           				callback();
						           			}
						           	}).catch(function(){
						           	 callback(new Error('查询有误'));
						           	});
								 	
							       };    
					        
					return {
						tableData3:${Product},//表格数据
						currentPage1: 5,
						currentPage2: 5,
						currentPage3: 5,
						currentPage4: 4,
						multipleSelection: [],
						dialogrepair: false,
						dialogDelete:false,
						tableloading:false,
						removeSearch:false,
						showInfo:false,//这个值是设置显示什么字段的判断值
						
						setId:-1,
						showSoltId:0,//这里设置字段是否显示
						//showpPcId:0,
						showpPrice:0,
						showpUnit:0,
						showpCost:0,
						showpStatus:0,
						showpRemarks:0,
						
						options3: [{
							label: '全部数据',
				            options: [{
				            	label:'全部数据',
				            	value:''
				            }]
						}, {
							label: '产品单位',
				            options: []			
						}, {
							label: '产品状态',
				            options: []			
						}],
						value7: '',
						value7Copy:'',
						printFlag1:false,//这个值是为了在打印的时候去掉一些不必要的元素
				        printFlag2:false,//这个值是为了在打印的时候去掉一些不必要的元素
				        value7Flag:false,
						option:'',
				        obj2:null,
				        state1:'',
				        state1Copy:'',
				        productCopy:'',
				        matchFlag:false,
				        state1Flag:false,
				        state1Session:false,
				        select:'1',
				        selectCopy:'1',
						form: {
							pName: '',
							//productclassify: '',
							pPrice: '',
							pUnit: '',
							pCost: '',
							pStatus: '1209',
							pRemarks: '',
							pId: '',
							state:1,
						},
						page:{
							pageCentent:[4, 6, 10],	
							AllpageNumber:${productCount}
						},
						pageNumber:1,								
						pageCententSelect:4,
						pId: '',
						pName: '',
						PcIds: '',
						pUnits: '',
						pStatus: '',
						pdID: '',
						value8: '',
						valuecust: '',
						DId:0,
						data:[],
						flag:false,
						dialogFormVisible: false,
						rules:{
							pName:[
							{	
								required: true,validator:checkPName, trigger: 'blur'
							}],
							pPrice:[
								{
									validator:checkPPrice, trigger: 'blur' 
								}
							],
							pCost:[
								{
									validator:checkPCost, trigger: 'blur' 
								}
							]
						},
						
					}
				},
						 
					
				methods: {
					//相当于一种会话，要一次会话结束之后才会变为初始值，废弃
					stateManagement(item,index){
						if(index==1){
							this.state1Flag=item;
							if(this.state1Flag){
								this.state1Session=true;
							}
						}
					},
					//1.当选择其他字段时，清除数据筛选条件中的之前字段的搜索条件
					//2.当字段数据为空时，清除搜索条件
					//3.当字段数据为非比配数据值时，清除搜索条件
					
					//1.是否切换了字段搜索，就将之前的搜索条件删除（不管是否存在），删除时判断是否有不分组条件，存在就设置删除3个元素，否则则为2个元素
					//2.当搜索框搜索条件不存在或者为空时，清除搜索条件，如果存在则保留
					clearData(){	
						console.log("触发方法clearData清除搜索条件判断");	
						console.log("olddata:"+this.data);
						console.log("select:"+this.select);
						console.log("输入框当前值:"+this.state1);	
						var del=null;
						var i=0;
						if(this.selectCopy=='1'){
							del='产品名称';
						}/* else{
							del='';
						} */
						if(this.selectCopy!=this.select){						
							console.log("del:"+del);
							this.data.find((a)=>{									
								if(a==del){
									console.log("a:"+a);
									if(this.data[i+1]=='不分组'){
										this.data.splice(i,3);											
									}else{
										this.data.splice(i,2);											
									}										
								}
								i++;
							});	
						this.selectCopy=this.select;
						}else{
							var flag=this.isMatch();
							console.log("搜索框的值是否匹配:"+flag);								
							if(!flag){
								this.data.find((a)=>{									
									if(a==del){
										console.log("进入:"+flag);
										console.log("a:"+a);
										if(this.data[i+1]=='不分组'){
											this.data.splice(i,3);											
										}else{
											this.data.splice(i,2);											
										}										
									}
									i++;
								});										
							}
						}
						console.log("newdata:"+this.data);																						
					},
					//判断是否匹配，采用方案为直接判断当前搜索框结果列表是否存在相同的值
					isMatch(){
						//1.当前的搜索框结果列表没有数据时，则判定为不存在匹配值，返回false
						//2.当前的搜索框结果列表有数据时,厉遍搜索框结果列表数据，如果不存在匹配值则返回false，否则返回true
						//3.当前的搜索框结果列表有数据时且搜索框结果列表数据有且只有只有一条数据，则直接返回true
						
						console.log("触发方法isMatch搜索框的值是否匹配"); 
						console.log("当前的搜索框结果列表数据长度:"+this.restaurants.length);	
						var i=0;
						var obj=false;
						if(this.restaurants.length==0){
							return false;
						}else if(this.restaurants.length==1){
							return true;
						}else{
							this.restaurants.find((a)=>{
								if(this.restaurants[i].value==this.state1){
									obj=true;
								}																				
								i++;
							});
							
							if(obj){
								return true;
							}
							return false;
						}
						
					},						
					//1.当字段不变时，替换原来的字段数据
					//2.当字段不变时,判断搜索框的值是否存在变化,没有变化则index索引值返回0,否则返回index
					//3.当字段不变时且输入宽的值和copy都为初始值时，放回flag=true
					checkData(){
						console.log("触发方法checkData搜索框字段不变时，替换原来的字段数据");
						console.log("olddata:"+this.data);
						console.log("select:"+this.select);
						console.log("输入框当前值:"+this.state1);
						var del=null;
						var i=0;
						var index=0;
						var obj={flag:true,index:index};
						
						if(this.state1Copy!=this.state1||this.state1Copy==''){
							if(this.select=='1'){
								del='产品名称';
							}/* else{
								del='';
							} */
							console.log("del:"+del);
							this.data.find((a)=>{									
								if(a==del){
									console.log("a:"+a);	
									index=i+1;
								}
								i++;
							});
							if(index>0){
							obj={flag:false,index:index};
							}
							console.log("index:"+index);	
							console.log("data的长度:"+this.data.length);
							this.state1Copy==this.state1;
						
						}else{
							if(this.state1==''){
								obj={flag:true,index:0};	
							}else{
								obj={flag:false,index:0};
							}
							
							
						}
						
						return obj;	
					},
					
					//这里是视图的跳转方法，传入产品信息id
					/* saleView(pId){
						window.open("product/productView?pId="+pId);    						 		
					}, */
					
					loadInfo(id){
					 // `this` 在方法里指向当前 Vue 实例	
					 alert(id);
					 
						var _this = this;
	           			var form='';
        				form=_this.form;
					 	
					 	/*
						------------------这个是修改的时候加载产品信息
						 */	 
					 if(id!=0){
					 	axios.get("/product/findOneProduct",
			           			//参数转换
			           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
			           			//ajax请求成功的回调函数
			           			{
					 		params:{
					 			pId:id
					 		}
			           			}
			          			).then(function(response){					          				
			           			console.log("回调成功，获取了服务器端返回的值v");
			           			console.log(response.data);
			           			_this.initForm(response.data,_this,id);
		          			}).catch(function(){
				           		alert("加载产品信息出错了");
				           	});	
					}else{
						_this.initForm(" ",_this,id);
						;
					}
			},
				/*
				上传产品图片
				*/
				/* handleRemove(file, fileList) {
		       		 console.log(file, fileList);
			      },
			    handlePreview(file) {
			        console.log(file);
			      }, */
				/*
				加载表单时的初始化
				*/
				initForm(json,_this,id){
           			var form='';
          			form=_this.form;
   				if(id!=0){
	     			form.pId=id+'';	
	     			form.pPcId=json.pPcId+'';
	     			form.pUnit=json.pUnit+'';
	     			form.pStatus=json.pStatus+'';
				  }else{
					  form.pStatus='1209';
					  form.pUnit=null;
					  form.pPcId=null;
					  form.pId=null;
				  } 
           			form.pName=_this.toString(json.pName);
           			form.pPrice=_this.toString(json.pPrice);
           			form.pCost=_this.toString(json.pCost);	
           			form.pImg=_this.toString(json.pImg);
           			form.pRemarks=_this.toString(json.pRemarks);			           		           			
				},
				//强制转换成String类型
				toString(val){
				return val==null?'':(val+'');
				},
				DeleteShow(pId){
					this.pId=pId;
					this.dialogDelete=true;
					
				},
				//删除方法
				Delete(){
					var _this=this;
					var data=''+this.data;
					axios.get("/product/Delete",
		           			//参数转换
		           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
		           			//ajax请求成功的回调函数
		           			{
								params:{
									pId:_this.pId
								}
		           			}
		          			).then(function(response){					          				
		           			console.log("回调成功，获取了服务器端返回的值v");
		           			console.log(response.data);

		           			//alert(_this.count);
			           			_this.$notify({
				           	          title: '删除成功',
				           	          type: 'success',
				           	       	  duration:3000
				           	        });
			           			/*
			           			-----------------------------刷新当前表单信息
			           			*/
			           			_this.page.AllpageNumber=_this.page.AllpageNumber-1;	
								console.log("当前页: "+_this.pageNumber);
								console.log("每页默认显示的条数:"+_this.pageCententSelect);
								_this.tableloading=true;
							 	axios.get("/product/productPageable",
					           			{
					           		params: {
					          				pageNumber:_this.pageNumber,
					          				pageCentent:_this.pageCententSelect,
					          				DId:data
					          			    }
					           			}
					           			//ajax请求成功的回调函数
					          			).then(function(response){					          				
					           			console.log("回调成功，获取了服务器端返回的值v");
					           			console.log(response.data);
					     		  _this.tableData3 = response.data.product;
					     		 _this.page.AllpageNumber=response.data.productCount;
					     		 _this.tableloading=false;	
					           	}).catch(function(){
					           		alert("显示数据出错了");
					           	});	
							 	
		           			}).catch(function(){						           				
		           				alert("删除信息出错了");
		           			});
				},			
				//优化处理弹框事件
				deathWindow(formName){						
					if(this.dialogFormVisible==false){
						this.$refs[formName].clearValidate();	
						this.salesOpportunityTrackingLogs=null;
					}
				},
					//这个是新增以及修改 表单提交事件
				      submitForm(formName) {
						//alert(this.form.salStage);
									var i=" ";
						    	    var obj = {};
									var _this=this;
									//分类
						    	   /*  if(_this.form.pPcId!=null&&_this.form.pPcId!=''){
							    	    obj = this.PcIds.find((a)=>{
								    	      return a.label ===_this.form.pPcId; 
								    	    });		
								    	   if(obj!=null){
									    	    _this.form.pPcId=obj.value;
								    	   }
						    	    }else{
						    	    	_this.form.pPcId=" ";
						    	    }  
						    	    console.log("分类:"+_this.form.pPcId);
						    	    this.form.productclassify=10; */
						    	    //单位
						    	    if(_this.form.pUnit!=null&&_this.form.pUnit!=''){
							    	    obj = this.pUnits.find((a)=>{
								    	      return a.label ===_this.form.pUnit; 
								    	    });	
								    	   if(obj!=null){
									    	    _this.form.pUnit=obj.value;	
								    	   }
						    	    }else{
						    	    	_this.form.pUnit=" ";
						    	    }
						    	    console.log("单位:"+ _this.form.pUnit);	
						    	   
				        this.$refs[formName].validate((valid) => {
				          if (valid) {
					            //alert('submit!');

			           			//console.log("log:"+Qs.stringify(this.form,{arrayFormat: 'brackets'}))		
			           			console.log(JSON.stringify(_this.form));
							 	axios.get("/product/productAdd",
					           			//参数转换
					           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})	
				           			{
				           		params:_this.form 
				           			}


					           			//json.stringify(this.form)
					           			//ajax请求成功的回调函数
					          			).then(function(response){
					           			_this.$refs[formName].resetFields();//清空数据
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);	
							           			_this.dialogFormVisible=false;
							           			if(_this.form.pId==null){
								           			_this.$notify({
									           	          title: '添加成功',
									           	          type: 'success',
									           	       	  duration:3000
									           	        });
								           			_this.page.AllpageNumber=_this.page.AllpageNumber+1;
							           			}else if(_this.form.pId!=null){
								           			_this.$notify({
									           	          title: '修改成功',
									           	          type: 'success',
									           	       	  duration:3000
									           	        });
							           			}else{
							           				
							           			}
							           			
					           			/*
					           			-----------------------------刷新当前表单信息
					           			*/						           								           			
										console.log("当前页: "+_this.pageNumber);
										console.log("每页默认显示的条数:"+_this.pageCententSelect);
										console.log("当id值: "+_this.form.pId);	
										
										if(_this.pageNumber==1||_this.form.pId!=null){
											_this.tableloading=true;
										 	axios.get("/product/productPageable",
								           			{
								           		params: {
								          				pageNumber:_this.pageNumber,
								          				pageCentent:_this.pageCententSelect,
								          				DId:_this.DId
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);	
									     		  _this.tableData3 = response.data.product;
									     		 _this.page.AllpageNumber=response.data.productCount;
									     		 _this.tableloading=false;
								           	}).catch(function(){
								           		alert("显示产品数据出错了");
								           	});												
										}


					           		//this.tableData3=response.data;					           		
					           	//	this.AllpageNumber=this.count/response.data.length;
					     		//  _this.tableData3 = response.data;					     							           					           	
					           	}).catch(function(){
					           		//_this.form.pId=i;
					           		alert("新增表单提交出错了");
					           	});				        	  
				          } else {
				            console.log('error submit!!');
				            return false;
				          }
				        });
				      },
			      //这个是表单重置方法
			      resetForm(formName) {
			        this.$refs[formName].resetFields();
			      },
			    //这个是表单的取消方法
			      cancelForm(formName){
			    	  this.dialogrepair = false;
			    	  this.dialogFormVisible = false;
			    	  this.$refs[formName].clearValidate();
			      },
			      
			    //这个是列表的选择事件
					 handleSelect(item) {
					    	  var _this=this;								        
					    	  if(item!=null){
							        console.log("value7Flag:"+this.value7Flag); 
					    		  if(this.value7Flag){							    			
						    		  _this.multipleSelection1(item);  
					    		  }
					    		  if(this.state1Session==true){
					    			  	  this.clearData();//清除搜索框的搜索条件
										 _this.searchSelect(item);								    			  
					    		  }
					    	  }else{
					    		
					    	  }	
			      		},
			    //这里是处理多选条件的方法
			      multipleSelection1(item){
			    	  var _this=this;
			    	  console.log(item[item.length-1]);								    	  
			    		 var DId=item[item.length-1];
			    		  var i=0;
			    		  var count=new Array();
				    	  var obj=null,obj2=null;
    					  var h=0,j=0;
						  console.log("value7:"+this.value7);
						  
						//  console.log("DId:"+DId);
						  //这里是所选值的循环
						  item.find((c)=>{
							  console.log("c:"+c);
							  console.log("options3:"+_this.options3.length);
							  
							  //下面是的循环代码是判断在同一个父类字典信息中是否存在多个选中的值
							  
							  //这里是option3列表循环
							  _this.options3.find((b)=>{ 
								  console.log("options3:"+i);
								  //这里是options所有值的循环
						    	   _this.options3[i].options.find((a)=>{	
					    		   
						    		  console.log("测试："+c);
						    			 if(a.value===c){
									    	   console.log("当前所在的options："+i);	
						    				// count++;//同一个options选中的值数
						    				 console.log("这个options存在于所选值相等的值");
						    				if(obj2==null){
						    					console.log("当前所在父类："+_this.options3[i].label);
							    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
							    				 count.push(obj2);
							    				 console.log("初始化看看是什么：value="+count[0].value+"\tcount="+count[0].count+"\tDId="+count[0].DId);
						    				}else{
						    					/*if(obj2.value==i){
					    						//obj2.count=2;
												//当同一个options的值重复时，修改对应count数组的值即+1	
												
					    						count.find((j)=>{
					    							if(j.value==i){
					    								j.count=2;
					    								j.newDId=a.value;
					    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].OldDId);
					    							}
					    							h++;
					    						});
					    						h=0;
					    					}else{
					    						//但不是一个同个options的值时，记录该值
						    				 obj2={value:i,count:1,OldDId:a.value,newDId:''};
							    				 count.push(obj2);
							    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.OldDId);
					    					}*/
					    					var flag=count.find((j)=>{
					    						//当同一个options的值重复时，修改对应count数组的值即+1	
					    							if(j.value==i){
					    								j.count=2;
					    								j.newDId=a.value;
					    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].DId);
					    								return 1;
					    							}
					    							h++;
					    						});
					    						h=0;
					    						 if(flag!=null){
					    							 
					    						 }else{
								    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
								    				 count.push(obj2);
								    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.DId);
					    						 }
						    				}



											//if(count==2){
							    				/* if(_this.obj2!=null){
								    				 console.log("这个 _this.obj2的值不为空,进入所选值循环:"+_this.obj2);												    					 
									    			 var j=0;												    			
									    			 _this.value7.find((b)=>{
												    		 //console.log("obj:"+obj); 													    		 
									    				  if(b==_this.obj2){
									    					  console.log("obj2:"+_this.obj2); 										    					  
									    					  console.log("所选值在改变之前的value7:"+ _this.value7); 
									    					  //_this.value7[j]=DId;
									    					 // _this.value7.pop();
									    					 _this.value7.shift();
									    					 // _this.value7[j]=null;
									    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
									    					  //_this.obj2.value=obj.value;
									    					  _this.obj2=_this.value7;												    					  
									    					  console.log("修改完value7值之后将最新所选值赋值给_this.obj2:"+_this.obj2); 												    					  
															return null;
									    				  }//b==_this.obj2
									    				 // j++;
									    			  });*/
							    				// }
							    				 /*else{
							    					 _this.obj2=c;
								    				 console.log("这个 _this.obj2的值等于空所有要给他赋值:"+ _this.obj2);										    					 
							    					 return;
							    				 }*/																					
											//}//count==2
							    			/* else{
						    					 _this.obj2=c;
							    				 console.log("这个 _this.obj2的值等于空所有要给他赋值:"+ _this.obj2);										    					 
						    					 return;
						    				 }*/
	    				 
						    			 }//a.value===c	

						    			 
							    	    });
						    	  console.log("obj:"+obj); 
						    	// if(obj!=null){										    		 
						    		// console.log("obj1:"+obj.value); 
						    		 /*
						    		 //第二次循环，判断所选值所在的options是否等于第一次所选择所在的options
						    		 //如果相等则进入所选值数组循环
						    		 */
						    		/* if(_this.options3[i].options==_this.option){
						    			 var j=0;
						    			
						    			 _this.value7.find((b)=>{
									    		 console.log("obj:"+obj.value); 													    		 
						    				  if(b==_this.obj2.value){
						    					  console.log("obj2:"+_this.obj2.value); 										    					  
						    					  console.log("value7:"+ _this.value7[j]); 
						    					  //_this.value7[j]=DId;
						    					  //_this.value7.pop();
						    					 // _this.value7[j]=null;
						    					  console.log("value7:"+ _this.value7); 
						    					  //_this.obj2.value=obj.value;
						    				  }
						    				  j++;
						    			  });	
					    				  _this.obj2.value=DId;
				    					  console.log(" _this.obj2.value:"+_this.obj2.value); 
						    			
						    		 }else{
								    	// _this.option=_this.options3[i].options;//记录用户所选值所在的options	
									    	_this.obj2=obj;  //这里记录选值的数值
								    		 console.log("options:"+_this.options); 
								    		 console.log("obj2:"+ _this.obj2.value);										    			 
						    		 }
						    	 }*/ 
								  i++;  //这里是options的自增索引值
							  });	
							  console.log("当前所选值结束列表循环-------------------------------------");
							  i=0;//将i重新赋值为0
						  });
						  this.removeSearch=true;
						  //这里我们厉遍我们记录的count数组
    						count.find((it)=>{
							    console.log("count的当前循环次数:"+h);
							    if(it==null){
							    	return 0;
							    }
    							//当选择的是全部数据时					    							
    							if(it.OldDId==''){			    								
								     console.log("选择的是全部数据:"+_this.value7.length);	
	    								if(_this.value7.length>1){
										    console.log("count:"+count.length);
	    									count.splice(0,count.length-1);	
										    console.log("count:"+count.length);	
										    
	    								}else{					    									
										     console.log("第一次选择非全部数据删除全部数据:");						    									
		    								 count.splice(h,1);				    									
	    								}
    								_this.value7.splice(0,_this.value7.length-1);
    								return 0;

    							}
    							
    							//当同一个的options出现重复值时
    							if(it.count==2){
					    			 _this.value7.find((b)=>{
							    		// console.log("obj:"+obj.value); 													    		 
				    				  if(b==it.OldDId){
				    					  console.log("odddddd:"+j.DId);								    					  
				    					 // console.log("obj2:"+_this.obj2.value); 										    					  
									     console.log("所选值在改变之前的value7:"+ _this.value7); 
				    					  //_this.value7[j]=DId;
				    					  //_this.value7.pop();
				    					 // _this.value7[j]=null;
				    					 //arrayObj.splice(deletePos,deleteCount); //删除从指定位置deletePos开始的指定数量deleteCount的元素，数组形式返回所移除的元素
				    					_this.value7.splice(j,1);
			    					 	 //count.splice(j,1);
				    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
				    					  //_this.obj2.value=obj.value;
				    				  }
			    						
				    				  j++;
				    			  });
					    			 j=0;
    								//console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count);
    							}
    							h++;
		    							
    						});
    						this.option=count;

			      },		
			      //搜索框，判断是否要进行分组查询
			      isGroup(flag){
			    	  var del=null;
			    	  var i=0;
			    	  var index=0;
			    	  var obj=true;
					    console.log("触发isGroup方法判断是否进行分组查询:"+flag);								    	  
					    console.log("Olddata:"+this.data);
						if(this.selectCopy=='1'){
							del='产品名称';
						}/* else{
							del='产品名称';
						} */
						this.data.find((a)=>{									
							if(a==del){
								console.log("a:"+a);
								index=i;
			           			if(this.data[i+1]=='不分组'&&flag){
									flag=false;
									index=0;
			           			}
							}
							i++;
						});

			    	  if(flag){
			    		  if(index>0){
								index=index+1;
								this.data.splice(index,0,'不分组');									    			  
			    		  }
						
			    	  }else{
			    		  index=index+1;	
			    		  if(this.data[index]=='不分组'){	
			    			console.log("ffffffff:");							    			  
							this.data.splice(index,1);								    			  									    								    			  
			    		  }

				    		  
			    	  }
					   console.log("newdata:"+this.data);
			      },							      
							      //这里是处理搜索框查询字段选择的方法
							      searchSelect(item){
							    	  console.log("item:"+item.value); 
											var _this = this;											    	
								    		_this.matchFlag=true;												
											var data=null;
											this.tableloading=true;
											//this.clearData();//剔除搜索宽里的分页条件
											//this.data.push('');
											var obj=this.checkData();
											if(obj.index>0){
												if(item.value!=null){
								           			if(this.data[obj.index]=='不分组'){
														this.data[obj.index+1]=item.value;									           				
								           			}else{
														this.data[obj.index]=item.value;	
								           			}														
												}

											
											}
											this.checkData();//这
											 this.isGroup(true);
											data=''+this.data;
						           			console.log("data:"+data);												
											  //post提交数据
								           	axios.get("/product/productPageable",
								           			{
								           		params: {
								          				pageNumber:1,
								          				pageCentent:4,
								          				DId:data
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);
								           		//this.tableData3=response.data;
												_this.tableData3=response.data.product;
												_this.page.AllpageNumber=response.data.productCount;
								     		 _this.tableloading=false;	
								           	}).catch(function(){
								           		alert("分页数据出错了");
								           	});												    		
							    	  
							    	  
				    	  
							      },
							      //这里是数据筛选下来宽事件
							  visibleChange(){
							    	  this.value7Flag=!this.value7Flag;
							    	  if(this.flag){
							    		  this.flag=false;
							    		//copy值记录value的变化值		
							    		  if(this.value7Copy==this.value7){
							    			  
							    		  }else{
								    		  this.screenQueries(); 								    			  
							    		  }
							    		  
							    	  }else{
							    		  this.flag=true;

							    	  }
							    
							      },    
							      //这里是数据筛选标签删除时的事件
							      removeTag(){
							    	  //console.log("item:"+item);	
							    	   console.log("触发removeTag数据筛选标签删除时的事件");
							    	  var _this=this;
							    	  var i=0;
							    	  console.log("value7的当前长度:"+_this.value7.length);
							    	  console.log("value7Copy的当前长度:"+_this.value7Copy.length);
							    	  console.log("value7:"+_this.value7);
							    	  console.log("value7Copy:"+_this.value7Copy);
							    	 var del=null;
							    	 //当value7为空时
							    	  if(_this.value7[0]==null){
							    		  //console.log("dd:"+_this.value7+"d");
							    		  console.log("条件搜索没有了呀，自动添加一个全部数据");
								    		_this.value7[0]='';	//表示添加一个全部数据									    		
									    	  console.log("olddata:"+_this.data.splice(1,1));	
								    		_this.data.push('');
								    		_this.removeSearch=false;
							    	  }
							    	 //查找被删除的值
							    		_this.value7Copy.find((a)=>{								    		  
							    		_this.value7.find((b)=>{ 
										   // console.log("被删除的值:"+b);								    			
							    			if(a!=b){
							    				del=a;

										    console.log("被删除的值del:"+del);	
							    			}
							    		
							    		}); 								    		 
							    	  });
							    	 
							    	  console.log("olddata:"+_this.data);								    	  
							    	  //删除data对等的数据
							    	  _this.data.find((c)=>{
							    		  if(del==c){
									    	  console.log("c:"+c);	
									    	  _this.data.splice(i-1,2);
							    		  }
							    		  i++;  

							    	  });								    	 								    	 
							    	  console.log("newdata:"+_this.data);
							    	  //同步copy值
							    	  _this.value7Copy=_this.value7;
							    	  console.log("新value7Copy:"+ _this.value7Copy);
							    	  var data=''+_this.data;
							    	  _this.tableloading=true;
								 	axios.get("/product/productPageable",
						           			//参数转换
					           			//Qs.stringify({ids:_this.value7}, {arrayFormat: 'indices'})
					           			{
						           		params:{
					          				pageNumber:1,
					          				pageCentent:4,		
						           			DId:data
						           		}
						           												 		
					           			}

						           			//json.stringify(this.form)
						           			//ajax请求成功的回调函数
						          			).then(function(response){
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);
								           			//console.log(response.data.salesCount);/
										_this.tableData3=response.data.product;
										_this.page.AllpageNumber=response.data.productCount;
						           	//	this.AllpageNumber=this.count/response.data.length;
						     		//  _this.tableData3 = response.data;	
										  _this.tableloading=false;
										_this.value7Copy=_this.value7;//copy值记录value的变化值
						           	}).catch(function(){
						           		//_this.form.customer=i;
						           		alert("筛选查询出错了");
						           	});									    	  

							      },
							   	  //这里是筛选查询的方法
							   	 screenQueries(){
							    	  var _this=this;
							    	  var obj=null;
						    	  /*
						    	---------------------------------------数据筛选查询  
						    	  */
						    	  console.log("option:"+_this.option);
									var data=new Array();
									var i=0;
									var index=0;
						    	  _this.option.find((a)=>{
							    	  console.log("option:"+a.OldDId+"\t"+a.parent);
							    	  _this.data.find((b)=>{
											if(b===a.parent||a.parent=='全部数据'){
												index=i;
											}
											i++;
								    	  });

								    	 if(index>0){
									    	  console.log("index:"+index);
									    	  if(a.count==2){
										    	  console.log("parent"+a.parent);	
									    		  _this.data[i-1]=a.newDId;	
									    	  }else{
									    		  _this.data[i-1]=a.OldDId;								    		  
									    	  } 									    		 
								    	 }else{
									    	  if(a.count==2){
									    		  _this.data.push(a.parent);
									    		  _this.data.push(a.newDId);	
									    	  }else{
									    		  _this.data.push(a.parent);	
									    		  _this.data.push(a.OldDId);								    		  
									    	  }
								    	 }
								    	  
								    	  });	
									  this.clearData();//剔除搜索宽里的分页条件	
							    	  data=''+_this.data;
							    	  console.log("data:"+data);	
							    	  _this.tableloading=true;	
								 	axios.get("/product/productPageable",
								 			{
						           		params: {
						          				pageNumber:1,
						          				pageCentent:4,
						          				DId:data
						          			    }
						           			}
						           			//ajax请求成功的回调函数
						          			).then(function(response){					          				
						           			console.log("回调成功，获取了服务器端返回的值v");
						           			console.log(response.data);
						           			
						     		  _this.tableData3 = response.data.product;
						     		 _this.page.AllpageNumber=response.data.productCount;
						     		 _this.tableloading=false;
						     		_this.value7Copy=_this.value7;//copy值记录value的变化值
						           	}).catch(function(){
						           		alert("筛选查询出错了");
						           	});
			     			 },
			    //这里是解除搜索，显示全部数据的方法
			      removeSearch1(){
					//数据筛选下拉框，初始化为全部数据
					this.value7.splice(0,this.value7.length);										
					this.value7[0]='';
					this.value7Copy=this.value7;//copy值记录value的变化值
					this.option=[{count:1,OldDId:'',parent:'全部数据'}];
					//清除搜索条件，只保留“全部数据”这个条件
					this.data.splice(2,this.data.length);;
					//调用数据筛选查询
					this.screenQueries();
					//将解除搜索按钮变为不可见
					this.removeSearch=false;
					//清除动态搜索框的输入数据
					this.state1=null;
			      },
			    //这里是加载产品名称的方法
				   withinProductFindByName(){
				    	  var _this=this;
		           			console.log("Data:"+_this.data);
		           			var data=''+_this.data;
						 	axios.get("/product/withinProductFindByName",
				           			{
				           		params: {
				           			DId:data
				          			    }
				           			}
				           			//ajax请求成功的回调函数
				          			).then(function(response){					          				
				           			console.log("回调成功，获取了服务器端返回的值v");
				           			console.log("修改:"+response.data);					           		
				           		_this.restaurants=response.data;
				           		
				           	}).catch(function(){
				           		alert("加载产品名称数据出错了");
				           	});	//这个是数据的初始化								    	  
				      },
				      //这里是加载产品id的方法
				      withinProductFindById(){
				    	  var _this=this;
		           			console.log("Data:"+_this.data);
		           			var data=''+_this.data;
						 	axios.get("/product/withinProductFindById",
				           			{
				           		params: {
				           			DId:data
				          			    }
				           			}
				           			//ajax请求成功的回调函数
				          			).then(function(response){					          				
				           			console.log("回调成功，获取了服务器端返回的值v");
				           			console.log("修改:"+response.data);					           		
				           		_this.restaurants=response.data;
				           		
				           	}).catch(function(){
				           		alert("加载产品id数据出错了");
				           	});	//这个是数据的初始化								    	  
				      },
				      
					 //这个是显示查询的数据
					 querySearchAsync(queryString, cb) {

					        var restaurants = this.restaurants;				       
					        var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;	
					        
					      	console.log("results:"+results);//查看返回结果如果不为空则表示在当前列表中存在比配值，为空表示没有比配值									        
							        if(queryString==null||queryString.length==0){
						        		 //当不为空,触发解除搜索功能,且解除搜索没有触发
						        		 if(this.state1!=null&&this.removeSearch!=true){
							        		 this.removeSearch=true;										        			 
						        		 }											        		 
							        	 if(this.state1Flag){
							        		 var obj=this.checkData();
							        		 if(obj.flag){
											     if(this.select=='1'){	    															    	
											    	 this.data.push('产品名称');
											    	 this.data.push("%");
											    	 this.withinProductFindByName();
											     }/* else{															    	 
											    	 this.data.push('产品ID');
											    	 this.data.push("%");
													 this.withinProductFindById();										    		 
											     }	 */												        			 
							        		 } 															    
									    	 															     

							        	 }
							        	if(this.soltIdFlag){
										     this.soltId=null;															    	 
									    	 this.abroadsaleAddUnameInfo(); 												        	 		
							        	 }

     
								        clearTimeout(this.timeout);
								        this.timeout = setTimeout(() => {
								       	cb(this.restaurants);
								       }, 3000* Math.random());	
							        }else{
								      	if(results==''){
								    	  console.log("queryString3:"+queryString);	
								    	  if(this.state1Flag){
								        		 var obj=this.checkData();
								    		     if(obj.flag){
												     if(this.select=='1'){
												    	 this.data.push('产品名称');
												    	 this.data.push(queryString);
												    	 this.withinProductFindById();																    	 
												     }/* else{																	    	 
												    	 this.data.push('产品名称');
												    	 this.data.push(queryString);
														 this.withinProductFindByName();											    		 
												     }														    		    	 
								    		     }else{
								    		    	 if(this.data[obj.index]=='不分组'){
												    	 this.data[obj.index+1]=queryString;													    		    		 
								    		    	 }else{
												    	 this.data[obj.index]=queryString;														    		    		 
								    		    	 }
												     if(this.select=='1'){
												    	 this.withinProductFindById();																    	 
												     }else{																	    	 
														 this.withinProductFindByName();											    		 
												     }	 */ 
								    		     }
								    		  
								    	  }
								        if(this.soltIdFlag){
										     this.soltId=queryString;;															    	 
									    	 this.abroadsaleAddUnameInfo(); 
							        	 		
								        }
										        clearTimeout(this.timeout);
										        this.timeout = setTimeout(() => {
										       ;
										       	cb(this.restaurants);
										       }, 3000* Math.random());		     

							        }else{
								        clearTimeout(this.timeout);
								        this.timeout = setTimeout(() => {												     
								       	cb(results);
								       }, 1000* Math.random());
								        
							        }
								    	  
							    }						
					      },
					      
					    //这个是根据输入的内容筛选数据
						   createStateFilter(queryString) {
						        return (state) => {return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);};
						      },
						handleClick(row) {
							console.log(row);
						},
						handleSelectionChange(val) {
							//console.log("共:"+val);
							this.multipleSelection = val;
						},
							
					//这个是选择显示数据条数事件
					handleSizeChange(val) {
						var _this = this;
						this.tableloading=true;
						this.pageCententSelect=val;
						console.log("当前页: "+this.pageNumber);
						console.log("每页默认显示的条数:"+this.pageCententSelect);
						this.clearData();//剔除搜索宽里的分页条件
						var data=''+this.data;
					 	axios.get("/product/productPageable",
			           			{
			           		params: {
			          				pageNumber:this.pageNumber,
			          				pageCentent:this.pageCententSelect,
			          				DId:data
			          			    }
			           			}
			           			//ajax请求成功的回调函数
			          			).then(function(response){					          				
			           			console.log("回调成功，获取了服务器端返回的值v");
			           			console.log(response.data);
			           		//this.tableData3=response.data;					           		
			           		_this.tableData3 = response.data.product;
			           		_this.page.AllpageNumber=response.data.productCount;
			     		 _this.tableloading=false;
			           	}).catch(function(){
			           		alert("显示客户数据出错了");
			           	});
					},
			    //这个是翻页事件
					handleCurrentChange(val) {
						var _this = this;
						this.pageNumber=val;
						this.tableloading=true;
						console.log("当前的分页条件: "+this.data);											
						console.log("当前页: "+val);
						console.log("每页默认显示的条数:"+this.pageCententSelect);
						this.clearData();//剔除搜索宽里的分页条件
						var data=''+this.data;
						  //post提交数据
			           	axios.get("/product/productPageable",
			           			{
			           		params: {
			          				pageNumber:this.pageNumber,
			          				pageCentent:this.pageCententSelect,
			          				DId:data
			          			    }
			           			}
			           			//ajax请求成功的回调函数
			          			).then(function(response){					          				
			           			console.log("回调成功，获取了服务器端返回的值v");
			           			console.log(response.data);
			           		//this.tableData3=response.data;
							_this.tableData3=response.data.product;
							_this.page.AllpageNumber=response.data.productCount;
			     		 _this.tableloading=false;	
			           	}).catch(function(){
			           		alert("分页数据出错了");
			           	});
					},
				      handleClose(done) {
				        this.$confirm('是否保存？')
				          .then(_ => {
				            done();
				          })
				          .catch(_ => {});
				      },
				      //这里是保存数据显示的方法
				      /*pName: '',
							pPcId: '',
							pPrice: '',
							pUnit: '',
							pCost: '',
							pStatus: '1209',
							pRemarks: '',
							pId: '',
				      */
				      saveshowInfo(){
				    	   var _this=this;
				    	   var arr=new Array();
				    	   arr=document.cookie;
				    	  var saveInfo=new Array();
				    	  saveInfo.push("pId:"+(_this.showpId?1:0));
				    	  saveInfo.push("pName:"+(_this.showpName?1:0));
				    	  saveInfo.push("pPcId:"+(_this.showpPcId?1:0));
				    	  saveInfo.push("pPrice:"+(_this.showpPrice?1:0));
				    	  saveInfo.push("pUnit:"+(_this.showpUnit?1:0));
				    	  saveInfo.push("pCost:"+(_this.showpCost?1:0));
				    	  saveInfo.push("pStatus:"+(_this.showpStatus?1:0));
				    	  saveInfo.push("pRemarks:"+(_this.showpRemarks?1:0));
				    	  saveInfo.push("userid:"+ arr);
				    	  saveInfo.push("setId:"+_this.setId);
				    	  
				    	  console.log(saveInfo);
				    		axios.get("/product/updateInfo",
				           			{
						 		params:{
						 			Info:(""+saveInfo)									 			
						 		}
						 			}
				          			).then(function(response){					          				
				           			console.log("回调成功，获取了服务器端返回的值v");
				           			console.log(response.data);
										
								
				           	}).catch(function(){
				           		alert("加载显示字段值失败");
				           	});	 	
				    		_this.showInfo=false;
				      } ,
				      print(obj){
				    	/* var newstr=document.getElementById('print').innerHTML;//得到需要打印的元素HTML
				    	 //bdhtml=window.document.body.innerHTML; 
				    	 //sprnstr="<!--printStart-->"; //开始打印标识字符串有17个字符
				    	// eprnstr="<!--printEnd-->"; //结束打印标识字符串
				    	// prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+ sprnstr.length); //从开始打印标识之后的内容
				    	// prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //截取开始标识和结束标识之间的内容
				    	 //window.document.body.innerHTML=prnhtml; //把需要打印的指定内容赋给body.innerHTML
				    	//保存当前页面的整个html，因为window.print()打印操作是打印当前页的所有内容，所以先将当前页面保存起来，之后便于恢复。
				    	var oldstr=document.body.innerHTML;//保存当前页面的html

				    		//执行打印操作
				    		//window.open();
					    	//把当前页面替换为打印内容HTML
				    		document.body.innerHTML=newstr;
				    		window.print();
				    		//还原当前页面
				    		document.body.innerHTML=oldstr;*/
				    	/*------------------------------------------*/
				    	//1.让新页面包含之前页面的引用
				    	//2.去掉多余的元素表格
				    			 var _this=this;
									 this.printFlag1=true;
								 setTimeout(function(){
									// newWindow.print();
									//window.print();	 
								 _this.printFlag2=true;
								 }, 300); 
								 setTimeout(function(){
										// newWindow.print();
										//window.print();
				    	
				    	
				    			var newWindow=window.open("产品信息列表","_blank");
								 var docStr = document.getElementById("print").innerHTML;
								// this.printFlag=false;
								 newWindow.document.write(docStr);
								 var styles=document.createElement("script");
								 var link=document.createElement("link");
								 var script=document.createElement("script");
								 script.setAttribute('src','https://unpkg.com/element-ui/lib/index.js');
								 
								  styles.setAttribute('src','https://unpkg.com/vue/dist/vue.js');// media="print"
								  
								  
								 link.setAttribute('rel','stylesheet');
								 link.setAttribute('href','https://unpkg.com/element-ui/lib/theme-chalk/index.css');//.appendChild(link).appendChild(script)
								 
								  var scriptContent=document.createElement("script");
								 	script.setAttribute('type',"text/jscript");
									 //		var Main1 = {data() {
								 	scriptContent.innerHTML="var Main1 = {data() {return{printFlag1:true}}} var Ctor = Vue.extend(Main1) new Ctor().$mount('div')";
/* 													 		"var mian{
								 	+"data(){return{printFlag1:true }}"	
								 	+"}var Ctor = Vue.extend(Main1) new Ctor().$mount('#print')" ; */
									 //this.printFlag1=true;
								 
								 newWindow.document.getElementsByTagName('head')[0].appendChild(styles);	
								 newWindow.document.getElementsByTagName('head')[0].appendChild(script);
								 newWindow.document.getElementsByTagName('head')[0].appendChild(link);	
	
								 newWindow.document.getElementsByTagName('head')[0].appendChild(scriptContent);	
								 //由于采用了引用，需要时间通过网络来获取样式加载，所以要给它加载的时间
								 //不能采用sleep的方式，会导致浏览器资源被占用，无法加载通过网络获取的颜色											 
								 _this.printFlag1=false;
									 setTimeout(function(){	 
									 _this.printFlag2=false;
									 }, 200); 
							 setTimeout(function(){

								 newWindow.print();
								 newWindow.close(); 
								//window.print();	 
							 }, 1000);																								
								 //_this.printFlag2=true;
								 }, 2000);

				      },
				      
				      //
				      sleep(n){
				    	  var start = new Date().getTime();
				          //  console.log('休眠前：' + start);
				          while (true) {
				              if (new Date().getTime() - start > n) {
				                  break;
				              }
				            }
				      },
				    //表格列样式设置
				       //表格行样式设置	
				      cellStyle({row,rowIndex,column,columnIndex}){
				    	  //column是个对象
				      
				    	  //console.log(columnIndex);
				      
				    	  if(rowIndex==this.pageCententSelect-1){
				    		  return 'border:1px solid #ebeef5;'
				    	  } 									    	  
				    	  
				    	  if(columnIndex==0){
				    		  return 'border-left:1px solid #ebeef5;border-right:1px solid #ebeef5;border-top:1px solid #ebeef5'
				    	  }
				      
				    	  return 'border-right:1px solid #ebeef5;border-top:1px solid #ebeef5;border-left:1px solid #ebeef5'
				      
				    	  },
},

				    //这里是页面初始化时加载数据的事件
					    mounted() {	
						this.data.push('全部数据');
						this.data.push('');
						//这里是加载产品名称信息
				    	this.withinProductFindByName();
				    	//this.withinProductFindById();
						//数据筛选下拉框，初始化为全部数据
						this.value7[0]='';
						this.value7Copy=this.value7;//copy值记录value的初始化值,数据筛选下拉框
						this.valueCopy=this.state1;//copy值记录value的初始化值,搜索框
				    	/*
				    	*
				    	数据筛选下拉框加载数据,加载字典信息
				    	*/					
							var _this = this;
		           			var form='';
	           				form=_this.form;
	           				axios.get("/product/productAddDictionaryInfo",
	    		           			//参数转换
	    		           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
	    		           			//ajax请求成功的回调函数
	    		          			).then(function(response){					          				
	    		           			console.log("回调成功，获取了服务器端返回的值v");
	    		           			console.log(response.data);
	    		           		_this.pUnits=response.data[0];
	    		           		_this.pStatus=response.data[1];
	    			           		//产品状态
	    			           	_this.options3[1].options=response.data[0];
	    			           _this.options3[2].options=response.data[1];
	    		           	}).catch(function(){
	    		           		alert("加载字典信息出错了！");
	    		           	});	
	           			//获取当前登录用户的编号
							var arr=new Array();
							var Id='';
								arr=document.cookie;
								console.log("当前用户的cookie:"+arr);
							/*	for(var i=0;i<arr.length;i++){
									if(arr[i]==";"){
										Id=arr.slice(i,arr.length)
									}
								}
								//获取当前登录用户的编号
								console.log("当前用户的cookie:"+Id);*/
							 	axios.get("/product/showInfo",
					           			{
							 		params:{
								 		userId:arr									 			
							 		}
							 			}
					          			).then(function(response){					          				
					           			console.log("回调成功，获取了服务器端返回的值v");
					           			console.log(response.data);
		 								/*setId:-1,
											showSoltId:0,//这里设置字段是否显示
											showpPcId:0,
											showpPrice:0,
											showpUnit:0,
											showpCost:0,pName
											showpStatus:0,
											showpRemarks:0,*/	
										_this.setId=response.data.setId;
										_this.showpName=0==response.data.showpName?false:true;
					           			_this.showPcId=0==response.data.showPcId?false:true;
										_this.showpPrice=0==response.data.showpPrice?false:true;
										_this.showpUnit=0==response.data.showpUnit?false:true;
										_this.showpCost=0==response.data.showpCost?false:true;
										_this.showpStatus=0==response.data.showpStatus?false:true;
										_this.showpRemarks=0==response.data.showpRemarks?false:true;
					           	}).catch(function(){
					           		alert("加载显示字段值失败");
					           	});	
						  },
				      }
		var Ctor = Vue.extend(Main1)
		//bigbox
		new Ctor().$mount('#bigbox')

		
	
	</script>
</body>
</html>
